<?php
namespace App\Models;

/*
 * Mock travel destination data.
 * Note that we don't have to extend CodeIgniter's model for now
 */

class Places {

    //mock data : an array of records
    protected $data = [
        '1' => [
            'id' => 1,
            'name' => 'Paris',
            'description' => 'The capital city of France, known for its art, fashion, gastronomy, and culture.',
            'link' => 'https://en.parisinfo.com/',
            'image' => 'paris.jpg',
        ],
        '2' => [
            'id' => 2,
            'name' => 'Rome',
            'description' => 'The capital city of Italy, known for its historical landmarks and rich culture.',
            'link' => 'https://www.rometoolkit.com/',
            'image' => 'rome.jpg',
        ],
        '3' => [
            'id' => 3,
            'name' => 'London',
            'description' => 'The capital city of the United Kingdom, known for its history, museums, and iconic landmarks.',
            'link' => 'https://www.visitlondon.com/',
            'image' => 'london.jpg',
        ],
        '4' => [
            'id' => 4,
            'name' => 'New York',
            'description' => 'A global city in the United States, known for its finance, culture, and entertainment.',
            'link' => 'https://www.nycgo.com/',
            'image' => 'newyork.jpg',
        ],
        '5' => [
            'id' => 5,
            'name' => 'Sydney',
            'description' => 'The largest city in Australia, known for its iconic Opera House and beautiful beaches.',
            'link' => 'https://www.sydney.com/',
            'image' => 'sydney.jpg',
        ],
    ];

    public function findAll() {
        return $this->data;
    }

    public function find($id = null) {
        if (!empty($id) && isset($this->data[$id])) {
            return $this->data[$id];
        }
        return null;
    }

}
